package zhongbo.java.air.monitor.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.listener.PatternTopic;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.listener.Topic;
import zhongbo.java.air.monitor.listener.RedisSubscribeLogChanelListener;

@Configuration
@Slf4j
public class RedisListenerConfig {
    public static String LIVE_FLIGHT_PATH_TANG_GUO_ZHENG = "live_flight_path_tang_guo_zheng";

    @Autowired
    public void configListener(RedisMessageListenerContainer listenerContainer,
                               RedisSubscribeLogChanelListener logChanelListener){
        Topic logTopic = new PatternTopic(LIVE_FLIGHT_PATH_TANG_GUO_ZHENG);
        listenerContainer.addMessageListener(logChanelListener,logTopic);

    }
}
